<?php


namespace app\api\middleware;


use think\facade\Request;
use think\facade\Db;
class Token
{
    public function handle($request, \Closure $next)
    {
        $token = trim(Request::header('token', ''),'"');
        if(!$token || $token == 'null'){return msg('0','请先登录');}
        $user = cache('user_token'.$token);
        if(!$user){ return msg('0','请先登录');}
        return $next($request);
    }
}